<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="btn"></div>
        <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
    <script>
        let aa = {}
        let arr = [];
        arr.map(item=>{
            // console.log(item);
            aa.a1 = item.a2
            console.log(aa)
        })
        console.log(aa)
        // var a1 = undefined
        // $('#btn').html(a1?a1: 2)
    </script>
</body>
</html>